cmake_minimum_required (VERSION 2.8) 
add_definitions(-DUNICODE -D_UNICODE -DHAVE_CONFIG_H)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
if(WIN32)
SET(GLOG_LIB libglog)
SET(TBB_DEBUG_LIB tbb_debug)
SET(TBB_LIB tbb)
SET(GFLAGS_LIB libgflags-debug)
#SET(SOCKET_LIB Ws2_32
elseif(UNIX)
SET(GLOG_LIB glog)
SET(GFLAGS_LIB gflags)
SET(TBB_DEBUG_LIB tbb)
SET(TBB_LIB tbb)
#SET(SOCKET_LIB )
endif()

include_directories(${PROJECT_SOURCE_DIR}/src/include ${PROJECT_BINARY_DIR})
add_executable (wordcount-simple wordcount-simple.cpp)
target_link_libraries (wordcount-simple hadoopcppclient ${GLOG_LIB}  ${OPENSSL_LIBRARIES} pthread ${QT_LIBRARIES})

add_executable (gennumbers gennumbers.cpp)
target_link_libraries (gennumbers ${GLOG_LIB} ${GFLAGS_LIB} ${QT_LIBRARIES})

add_executable (localsum localsum.cpp)
target_link_libraries (localsum ${GLOG_LIB} ${GFLAGS_LIB} ${QT_LIBRARIES})

#include_directories(${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_INCLUDE_DIRS})
#PROTOBUF_GENERATE_CPP(LOGDATA_PROTO_SRCS LOGDATA_PROTO_HDRS "logdatatype.proto")
#add_executable (adplay adplay.cpp ${LOGDATA_PROTO_SRCS} ${LOGDATA_PROTO_HDRS})
#target_link_libraries (adplay ${GLOG_LIB} hadoopcppclient ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARIES})



add_executable (numbersum numbersum.cpp)
target_link_libraries (numbersum ${GLOG_LIB} ${GFLAGS_LIB} hadoopcppclient ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} )



if(UNIX)
add_definitions(-DSZL_BIG_ENDIAN=1 -DSZL_LITTLE_ENDIAN=2 -DSZL_BYTE_ORDER=2 -DSZL_USES_MEMORY_LIMIT)
add_executable (szlmapper szl.cpp)
target_link_libraries (szlmapper hadoopcppclient ${GLOG_LIB} ${GFLAGS_LIB} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} szl szlemitters szlintrinsics)
endif()

#target_link_libraries(logloader mysqlclient mysqlcppconn gflags glog ${PROTOBUF_LIBRARIES} leveldb snappy profiler)

